import { functionCommon, requestCommon } from "@whzhuke/common"

export default {
  allOrderList: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/all`,
      params
    })
  },//查询所有订单分页列表
  myselfOrderList: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/myself`,
      params
    })
  },//查询我的订单分页列表
  edit: (params: any) => {
    return requestCommon.put<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/`,
      params
    })
  },//修改订单

  submit: (params: any) => {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/`,
      params
    })
  },//提交订单

  item: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/${params.id}`
    })
  },//查询订单详情
  certificate: (params: any) => {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/v1/api/order/certificate`
    })
  },//上传支付凭证
  del: (params: any) => {
    return requestCommon.del<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/${params.id}`,
      params
    })
  },//删除订单
  cancel: (params: any) => {
    return requestCommon.put<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/${params.id}/cancel`,
      params
    })
  },//手动取消订单
  refund: (params: any) => {
    return requestCommon.postJson<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/refund`,
      params
    })
  },//订单退款
  invoice: (params: any) => {
    return requestCommon.patch<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/invoice`,
      params
    })
  },//填写发票信息
  nums: (params: any) => {
    return requestCommon.get<any>({
      url: `${functionCommon.requestHost("api")}/v1/m/orders/${params.userId}/nums`
    })
  }//查询用户订单数量

}
